;
(function ($, g) {
    'use strict';

    //获取时间格式:yyyymmdd
    function js_yyyymmdd () {
      var now = new Date();
      var year = "" + now.getFullYear();
      var month = "" + (now.getMonth() + 1); if (month.length == 1) { month = "0" + month; }
      var day = "" + now.getDate(); if (day.length == 1) { day = "0" + day; }
      return year + month + day;
    }
    
    //获取时间格式:hhmmss
    function js_hhmmss () {
      var now = new Date();
      var hour = "" + now.getHours(); if (hour.length == 1) { hour = "0" + hour; }
      var minute = "" + now.getMinutes(); if (minute.length == 1) { minute = "0" + minute; }
      var second = "" + now.getSeconds(); if (second.length == 1) { second = "0" + second; }
      return hour + minute + second;
    }
    
    
    //获取时间指定位置的数字,时间格式：1480917652648
    function js_get_time(start,len){
        var now = new Date();
        return now.getTime().toString().substr(start,len);
    }
    

    // 获取当前url后附加的参数
    function getUrlParam(argName) {
        var args = location.href.split("?");
        var retval = "";
        var str = decodeURI(args[1]);
        if (str) {
            var _args = str.split("#")[0];
            args = _args.split("&");
            for (var i = 0; i < args.length; i++) {
                _args = args[i];
                var arg = _args.split("=");
                if (arg.length <= 1)
                    continue;
                if (arg[0] == argName)
                    retval = arg[1];
            }
        }
        return retval;
    }
    // 获取opendid
    function get_openid() {
        var openid = sessionStorage.getItem('openid');
        return openid;
    }
    
    g.js_yyyymmdd = js_yyyymmdd;
    g.js_hhmmss = js_hhmmss;
    g.js_get_time = js_get_time;
    g.getUrlParam = getUrlParam;
    g.get_openid = get_openid;
    
})(jQuery, window);
